package com.lh.music.test;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.lh.music.R;

import java.util.ArrayList;
import java.util.List;

public class RecycleActivity extends AppCompatActivity {
    private RecyclerView recyclerView;
    private List<String> mData=new ArrayList<>();
    RecyclerView.Adapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycle);
        recyclerView= (RecyclerView) findViewById(R.id.recyclerView);
        initData();
        LinearLayoutManager manager=new LinearLayoutManager(this);
        recyclerView.setLayoutManager(manager);
        adapter=new LinearAdapter(this,mData);
        recyclerView.setAdapter(adapter);
    }

    private void initData() {
        String s="标题";
        for (int i=0;i<20;i++){
            mData.add(s+i);
        }
    }
}
